package com.fable.ntzw_ga.controller;


import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.fable.common.vo.ResultVO;
import com.fable.ntzw_ga.entity.FeastUser;
import com.fable.ntzw_ga.service.IFeastUserService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;



/**
 * @author Created by gzh 2023-01-31 23:12:25
 */

@Api(tags = "主客管理")
@RestController
@RequestMapping("/ntzw_ga/feast-user")
public class FeastUserController {


    @Autowired
    IFeastUserService iFeastUserService;


    @ApiOperation(value = "添加管理员")
    @PostMapping("/save")
    public ResultVO saveFeastUser(@RequestBody FeastUser feastUser) {
        return ResultVO.okResult(iFeastUserService.save(feastUser));
    }

    @ApiOperation(value = "修改管理员")
    @PutMapping("/update/{id}")
    public ResultVO updateFeastUser(@PathVariable String id, @RequestBody FeastUser feastUser) {
        return ResultVO.okResult(iFeastUserService.update(feastUser, new LambdaQueryWrapper<FeastUser>().eq(FeastUser::getId, id))) ;
    }

    @ApiOperation(value = "删除")
    @DeleteMapping("/delete/{id}")
    public ResultVO deleteFeastUser(@PathVariable Long id) {
        iFeastUserService.removeById(id);
        return ResultVO.okResult() ;
    }
}
